package com.itheima.ZuoYe;

import java.util.Scanner;

public class ID {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入身份证号码");
        String s = sc.nextLine();
        System.out.println(get(s));

    }
    public static boolean get(String s){
        if (s == null){
            return  false;
        }
        if(s.startsWith("0")){
            return false;

        }
        if (s.length() != 18){
            return false;
        }
        for(int i =0; i < s.length();i++){
            char ch = s.charAt(i);

            if (i==s.length()-1){
                if (ch <'0' || ch >'9' && ch != 'X'){
                    return false;
                }
            }else{
                if (ch < '0' || ch > '9'){
                    return false;
                }
            }
        }
        return true;
    }
}
